package vn.hoasua.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

import android.annotation.SuppressLint;

public class TimeUtil {
	long crtTime;
	Calendar calendar;
	public TimeUtil(long millisecond){
		crtTime = millisecond;
		calendar = Calendar.getInstance();
		calendar.setTimeInMillis(millisecond);
	}
	
	public String getDayInWeek(String lang){
		String day = calendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.US);
		if(lang.equals("") || lang.compareToIgnoreCase("vi")==0){
			if(day.equalsIgnoreCase("Monday")) return "Thứ 2";
			if(day.equalsIgnoreCase("Tuesday")) return "Thứ 3";
			if(day.equalsIgnoreCase("Wednesday")) return "Thứ 4";
			if(day.equalsIgnoreCase("Thursday")) return "Thứ 5";
			if(day.equalsIgnoreCase("Friday")) return "Thứ 6";
			if(day.equalsIgnoreCase("Saturday")) return "Thứ 7";
			if(day.equalsIgnoreCase("Sunday")) return "Chủ nhật";
		}
		return day;
	}
	
	public int getDayInMonth(String lang){
		return calendar.get(Calendar.DAY_OF_MONTH);
	}
	
	public String getMonthShort(String lang){
		return calendar.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.US);
	}
	
	@SuppressLint("SimpleDateFormat")
	public static String getCurrentTimeFormat(){
		SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
		Date date = new Date();
	    return dateFormat.format(date);
	}
}
